 package com.davydov.suabl.model;
 import java.awt.Image;
 import java.util.ArrayList;
 import com.davydov.suabl.Force;
 import com.davydov.suabl.Position;
 public class ElectricalPorcupineMonster extends Character {
 private static final int numShots = 5;
 protected ElectricalPorcupineMonster(int health, int mass, Position pos, Image avatar) {
	 super(health, mass, pos, avatar);
 }
 
 public String getName() {
	 return "ElectricalPorcupineMonster";
 }
 @Override
 void die(Environment env) {
	 // TODO Auto-generated method stub
	 env.remove(this); //works with real environment
 }
 @Override
 void fire(Environment env) {
	 // TODO Auto-generated method stub
	 double criticalAngle = Math.PI / numShots;
	 for (int x = 1; x <= numShots; x++)
	 {
		 Pellet bullet = new Pellet(1, 0, this.getPosition());
		 //did I do this right, I never handled an exception before
		 try {
			 env.add(bullet);
			 
		 } catch (OutsideEnvironmentException e)
		 {
			 System.out.print("OutsideEnvironmentException");
		 }
		 bullet.setNetForce(new Force(x * criticalAngle,100));
	 }
  
 }
 @Override
 public void tick(Environment env) {
	 // TODO Auto-generated method stub
	 //NOT DONE YET
	 //get hero
	 ArrayList<PhysicsObject> creatures = env.getAllObjects();
	 HeroCharacter hero = null;
	 for (int i = 0; i < creatures.size(); i++)
	 {
		 if (env.getAllObjects().get(i) instanceof HeroCharacter)
		 {
			 hero = (HeroCharacter)env.getAllObjects().get(i);
		 }
	 }
	 //if not there, then don't do anything
	 if (hero == null)
	 {
		 return;
	 }
  
  
}
 
}


